home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / xf2.3-p / xf2 / xf2.3 / elements / Button next >
Encoding:
Text File  |  1993-11-20  |  5.4 KB  |  171 lines

  1. # Program: xf
  2. # Description: handle button widgets
  3. #
  4. # $Header: Button[2.3] Wed Mar 10 11:58:30 1993 garfield@garfield frozen $
  5.  
  6. global xfDefaultConf
  7. set xfDefaultConf(button) 4
  8.  
  9. ##########
  10. # Procedure: XFAdd.Button
  11. # Description: add a button
  12. # Arguments: xfW - the widget
  13. #            xfName - a optional name
  14. #            xfType - add or config
  15. # Returns: none
  16. # Sideeffects: none
  17. ##########
  18. proc XFAdd.Button {xfW xfName xfType} {
  19.   global xfStatus
  20.  
  21.   XFEditSetStatus "Inserting Button..."
  22.   set xfName [XFMiscGetUniqueName $xfName button]
  23.   if {"$xfStatus(path)" == "."} {
  24.     if {"$xfType" == "add"} {
  25.       button .$xfName \
  26.         -text "$xfName" \
  27.         -relief raised
  28.     } {
  29.       button .$xfName
  30.     }
  31.  
  32.     XFMiscPositionWidget .$xfName
  33.     XFMiscBindWidgetTree .$xfName
  34.   } {
  35.     if {"$xfType" == "add"} {
  36.       button $xfStatus(path).$xfName \
  37.         -text "$xfName" \
  38.         -relief raised
  39.     } {
  40.       button $xfStatus(path).$xfName
  41.     }
  42.  
  43.     XFMiscPositionWidget $xfStatus(path).$xfName
  44.     XFMiscBindWidgetTree $xfStatus(path).$xfName
  45.   }
  46.  
  47.   incr xfStatus(elementCounter)
  48.   XFEditSetPath $xfStatus(path)
  49.   XFEditSetStatus "Inserting Button...done"
  50. }
  51.  
  52. ##########
  53. # Procedure: XFConfig.Button4
  54. # Description: configure a button
  55. # Arguments: xfW - the widget
  56. #            xfType - config type (add or config)
  57. #            xfClass - the class we configure
  58. #            xfLeader - the leading window
  59. # Returns: none
  60. # Sideeffects: none
  61. ##########
  62. proc XFConfig.Button4 {xfW xfType xfClass {xfLeader ""}} {
  63.   global xfConf
  64.   global xfStatus
  65.  
  66.   if {"$xfType" == "add"} {
  67.     set xfName button$xfStatus(elementCounter)
  68.   } {
  69.     set xfName [XFMiscPathName $xfW]
  70.   }
  71.   XFEditSetStatus "Calling parameter setting for Button..."
  72.  
  73.   # build widget structure
  74.   XFTmpltToplevel .xf${xfClass}Config4 400x470 \
  75.     "Button parameters:[XFMiscPathTail $xfW]" $xfLeader
  76.  
  77.   XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
  78.     XFButtonSetButton4 parameters $xfName 4
  79.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
  80.     background Background "Background" XFButtonSetButton4
  81.   XFElementBitmap $xfW .xf${xfClass}Config4 $xfType $xfClass \
  82.     XFButtonSetButton4
  83.   XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass font \
  84.     font Font "Font" XFButtonSetButton4
  85.   if {$xfConf(kanji)} {
  86.     XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass kanjifont \
  87.       kanjiFont KanjiFont "Kanji font" XFButtonSetButton4
  88.   }
  89.   XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass fg \
  90.     foreground Foreground "Foreground" XFButtonSetButton4
  91.   XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass text text Text \
  92.     "Label" XFButtonSetButton4 $xfName
  93.   XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass \
  94.     XFButtonSetButton4
  95.   XFElementTextVariable $xfW .xf${xfClass}Config4 $xfType $xfClass \
  96.     XFButtonSetButton4
  97.   XFElementCommand $xfW .xf${xfClass}Config4 $xfType
  98.  
  99.   # save current parameter
  100.   if {$xfConf(kanji)} {
  101.     XFElementSave $xfW $xfClass {background bitmap command font kanjifont foreground height text textvariable width}
  102.   } {
  103.     XFElementSave $xfW $xfClass {background bitmap command font foreground height text textvariable width}
  104.   }
  105.  
  106.   # packing
  107.   pack append .xf${xfClass}Config4.params1 \
  108.               .xf${xfClass}Config4.params1.params2 {left fill expand}
  109.   pack append .xf${xfClass}Config4 \
  110.               .xf${xfClass}Config4.pathname {top fill frame center} \
  111.               .xf${xfClass}Config4.leave {bottom fill} \
  112.               .xf${xfClass}Config4.additional {bottom fill} \
  113.               .xf${xfClass}Config4.params1 {top fill expand}
  114.  
  115.   XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
  116.     "XFButtonSetButton4 $xfW 0 $xfClass"
  117.  
  118.   XFEditSetStatus "Calling parameter setting for Button...done"
  119. }
  120.  
  121. ##########
  122. # Procedure: XFButtonSetButton4
  123. # Description: set button parameters
  124. # Arguments: xfW - the widget
  125. #            xfType - the type of setting (1 = set always, 0 = set
  126. #                     only if permanent apply is on)
  127. #            xfClass - the class we configure
  128. #            xfParam1 - ignored parameter
  129. # Returns: none
  130. # Sideeffects: none
  131. ##########
  132. proc XFButtonSetButton4 {xfW xfType xfClass {xfParam1 ""}} {
  133.   global xfConf
  134.   global xfMisc
  135.  
  136.   if {$xfType == 0 && !$xfConf(applyParameters)} {
  137.     return
  138.   }
  139.   if {"[info commands $xfW]" == ""} {
  140.     return
  141.   }
  142.   XFMiscSetSymbolicName $xfW \
  143.     [.xf${xfClass}Config4.params1.params2.symname.symname get]
  144.  
  145.   XFMiscSetResource $xfW background \
  146.     [.xf${xfClass}Config4.params1.params2.bg.bg get]
  147.   XFMiscSetResource $xfW bitmap \
  148.     [.xf${xfClass}Config4.params1.params2.bitmap.bitmap get]
  149.   XFMiscSetResource $xfW command \
  150.     [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
  151.   XFMiscSetResource $xfW font \
  152.     [.xf${xfClass}Config4.params1.params2.font.font get]
  153.   if {$xfConf(kanji)} {
  154.     XFMiscSetResource $xfW kanjifont \
  155.       [.xf${xfClass}Config4.params1.params2.kanjifont.kanjifont get]
  156.   }
  157.   XFMiscSetResource $xfW foreground \
  158.     [.xf${xfClass}Config4.params1.params2.fg.fg get]
  159.   XFMiscSetResource $xfW height \
  160.     [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
  161.   XFMiscSetResource $xfW text \
  162.     [.xf${xfClass}Config4.params1.params2.text.text get]
  163.   XFMiscSetResource $xfW textvariable \
  164.     [.xf${xfClass}Config4.params1.params2.textvar.textvar get]
  165.   XFMiscSetResource $xfW width \
  166.     [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
  167. }
  168.  
  169. # eof
  170.  
  171.